
#include<string>

std::string oper="+-*/%";

class Task
{
public:
    //初始化
	Task(int x,int y,char oper)
	:_x(x),_y(y),_oper(oper),_result(0),_correct(0)
	{
	}
    
	//运行
	int run()
	{
		switch (_oper)
		{
		case '+':
		    _result=_x+_y;
			break;
		case '-':
			_result=_x-_y;
			break;
		case '*':
			_result=_x*_y;
			break;
		case '/':
			if(_y==0) _correct=1;
			else _result=_x/_y;
			break;
		case '%':
			if(_y==0) _correct=1;
			else _result=_x%_y;
			break;
		default:
			_correct=2;
			break;
		}
	}
    
	//消费者拿的任务
	std::string GetResult()
	{
		std::string rs=std::to_string(_x);
		rs+=_oper;
		rs+=std::to_string(_y);
		rs+="=";
		rs+=std::to_string(_result);
		rs+="[";
		rs+=std::to_string(_correct);
		rs+="]";

        return rs;
	}
   
	//生产者生产的任务
	std::string GetTask()
    {
        std::string r = std::to_string(_x);
        r += _oper;
        r += std::to_string(_y);
        r += "=?";
        return r;
	}
    
	~Task()
	{}

private:
	int _x;        
	int _y;
	int _result;      //结果
	char _oper;       //运算符
	int _correct;     //值是否正确
};